var global_logined = false;

$(function(){
	_.desktop.init();
	_.desktop.initUI();	//初始化布局
	$(window).resize(_.desktop.initUI);	//注册事件，当window发生变化的时候出发事件
	
	_.desktop.initEvent();	//初始化事件
	_.desktop.switcher.switchScreen(1);	//默认显示第一屏
	
	_.Changer($("body"));
	
	_.Skin.addSkin({
		name : "default",
		css : [
			"jdreamer/theme/desktop/skin/glass/jdreamer.desktop.css",
			"jdreamer/skin/glass/jdreamer.core.css",
			"jdreamer/skin/glass/jdreamer.messager.css",
			"jdreamer/skin/glass/jdreamer.window.css",
			"jdreamer/skin/glass/jdreamer.link.css",
			"jdreamer/skin/glass/jdreamer.button.css",
			"jdreamer/skin/glass/jdreamer.validate.css",
			"jdreamer/skin/glass/jdreamer.contextmenu.css",
			"jdreamer/skin/glass/jdreamer.widget.css",
			"jdreamer/skin/glass/jdreamer.tab.css"
		],
		iehack : [
			"jdreamer/skin/glass/jdreamer.ie6ie7.css",
			"jdreamer/theme/desktop/skin/glass/jdreamer.ie6ie7.css"
		],
		iefilter : [
			"jdreamer/skin/glass/jdreamer.filter.css",
			"jdreamer/theme/desktop/skin/glass/jdreamer.filter.css"
		]
	});
	_.Skin.addSkin({
		name : "ma",
		css : [
			"jdreamer/theme/desktop/skin/ma/jdreamer.desktop.css",
			"jdreamer/skin/ma/jdreamer.core.css",
			"jdreamer/skin/ma/jdreamer.messager.css",
			"jdreamer/skin/ma/jdreamer.window.css",
			"jdreamer/skin/ma/jdreamer.link.css",
			"jdreamer/skin/ma/jdreamer.button.css",
			"jdreamer/skin/ma/jdreamer.validate.css",
			"jdreamer/skin/ma/jdreamer.contextmenu.css",
			"jdreamer/skin/ma/jdreamer.widget.css"
		],
		iehack : [
			"jdreamer/skin/ma/jdreamer.ie6ie7.css",
			"jdreamer/theme/desktop/skin/ma/jdreamer.ie6ie7.css"
		],
		iefilter : [
			"jdreamer/skin/ma/jdreamer.filter.css",
			"jdreamer/theme/desktop/skin/ma/jdreamer.filter.css"
		]
	});
	_.Skin.addSkin({
		name : "mac",
		css : [
			"jdreamer/theme/desktop/skin/mac/jdreamer.desktop.css",
			"jdreamer/skin/mac/jdreamer.core.css",
			"jdreamer/skin/mac/jdreamer.messager.css",
			"jdreamer/skin/mac/jdreamer.window.css",
			"jdreamer/skin/mac/jdreamer.link.css",
			"jdreamer/skin/mac/jdreamer.button.css",
			"jdreamer/skin/mac/jdreamer.validate.css",
			"jdreamer/skin/mac/jdreamer.contextmenu.css",
			"jdreamer/skin/mac/jdreamer.widget.css"
		],
		iehack : [
			"jdreamer/skin/mac/jdreamer.ie6ie7.css",
			"jdreamer/theme/desktop/skin/mac/jdreamer.ie6ie7.css"
		],
		iefilter : [
			"jdreamer/skin/mac/jdreamer.filter.css",
			"jdreamer/theme/desktop/skin/mac/jdreamer.filter.css"
		]
	});
	
	_.Skin.chooser("default");
	
	var win = $(window);
	var winWidth = win.width();
	var mp3player = _("#widget_mp3player");
	mp3player.left(winWidth - mp3player.width() - 30);
	var clock = _("#widget_clock");
	clock.left(winWidth - clock.width() - mp3player.width() - 60);
});